package com.fount4j.generator.introspector;

import com.fount4j.generator.config.PropertyHolder;
import com.fount4j.generator.context.GeneratorContext;

/**
 * 普通文件解析器，如 XML、HTML、JSP 等非 Java 类的文件
 *
 * @author Morven 2017/1/3
 */
public abstract class FileIntrospector extends PropertyHolder {
    /** Info 在模板文件中的 key */
    protected String infoKey;
    /** 是否生成 */
    protected Boolean generate = Boolean.TRUE;
    /** 模板文件名 */
    protected String template;
    /** 文件路径 */
    protected String resourcePath;
    /** 文件所属包，“.”会被解析为路径分隔符 */
    protected String packageName;

    public String getTemplate() {
        return template;
    }

    public void setTemplate(String template) {
        this.template = template;
    }

    public String getInfoKey() {
        return infoKey;
    }

    public void setInfoKey(String infoKey) {
        this.infoKey = infoKey;
    }

    public Boolean getGenerate() {
        return generate;
    }

    public void setGenerate(Boolean generate) {
        this.generate = generate;
    }

    public boolean isGenerateEnable() {
        return generate != null && generate;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public String getResourcePath() {
        return resourcePath;
    }

    public void setResourcePath(String resourcePath) {
        this.resourcePath = resourcePath;
    }

    public abstract void introspect(GeneratorContext context);
}